<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SkyGameEngine2d: SpriteFrame类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="shpe.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SkyGameEngine2d
   &#160;<span id="projectnumber">0.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="#pro-methods">Protected 成员函数</a> &#124;
<a href="class_sprite_frame-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">SpriteFrame类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>精灵帧  
 <a href="class_sprite_frame.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="_sprite_frame_8h_source.html">SpriteFrame.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a1d8c776029a8731967ab5a7e206f8954"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#a1d8c776029a8731967ab5a7e206f8954">~SpriteFrame</a> ()</td></tr>
<tr class="memdesc:a1d8c776029a8731967ab5a7e206f8954"><td class="mdescLeft">&#160;</td><td class="mdescRight">析构  <a href="#a1d8c776029a8731967ab5a7e206f8954">更多...</a><br /></td></tr>
<tr class="separator:a1d8c776029a8731967ab5a7e206f8954"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7caab90d4ee888a3260f36c52146ca6d"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="class_rect.html">Rect</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#a7caab90d4ee888a3260f36c52146ca6d">getRect</a> () const</td></tr>
<tr class="memdesc:a7caab90d4ee888a3260f36c52146ca6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取精灵帧在纹理中的矩形位置  <a href="#a7caab90d4ee888a3260f36c52146ca6d">更多...</a><br /></td></tr>
<tr class="separator:a7caab90d4ee888a3260f36c52146ca6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97b4f437895f61f48aa6462930a5c298"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#a97b4f437895f61f48aa6462930a5c298">setRect</a> (const <a class="el" href="class_rect.html">Rect</a> &amp;rect)</td></tr>
<tr class="memdesc:a97b4f437895f61f48aa6462930a5c298"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置精灵帧在纹理中的矩形区域  <a href="#a97b4f437895f61f48aa6462930a5c298">更多...</a><br /></td></tr>
<tr class="separator:a97b4f437895f61f48aa6462930a5c298"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e8ab6dc78b0698ec1ee82dcd5258c6b"><td class="memItemLeft" align="right" valign="top">std::weak_ptr&lt; <a class="el" href="class_texture2_d.html">Texture2D</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#a3e8ab6dc78b0698ec1ee82dcd5258c6b">getTexture</a> ()</td></tr>
<tr class="memdesc:a3e8ab6dc78b0698ec1ee82dcd5258c6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取精灵帧的纹理  <a href="#a3e8ab6dc78b0698ec1ee82dcd5258c6b">更多...</a><br /></td></tr>
<tr class="separator:a3e8ab6dc78b0698ec1ee82dcd5258c6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:a6b16fce25f8844bd0b076ba2097e5aa0"><td class="memItemLeft" align="right" valign="top">static std::shared_ptr&lt; <a class="el" href="class_sprite_frame.html">SpriteFrame</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#a6b16fce25f8844bd0b076ba2097e5aa0">createFromPicture</a> (const std::wstring &amp;file_name)</td></tr>
<tr class="memdesc:a6b16fce25f8844bd0b076ba2097e5aa0"><td class="mdescLeft">&#160;</td><td class="mdescRight">从一张图片创建一个精灵帧  <a href="#a6b16fce25f8844bd0b076ba2097e5aa0">更多...</a><br /></td></tr>
<tr class="separator:a6b16fce25f8844bd0b076ba2097e5aa0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4eda9a9e4569d2dd5cb26568087c4e70"><td class="memItemLeft" align="right" valign="top">static std::shared_ptr&lt; <a class="el" href="class_sprite_frame.html">SpriteFrame</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#a4eda9a9e4569d2dd5cb26568087c4e70">createFromPicture</a> (const std::wstring &amp;fileName, const <a class="el" href="class_rect.html">Rect</a> &amp;des_rect_in_tex)</td></tr>
<tr class="memdesc:a4eda9a9e4569d2dd5cb26568087c4e70"><td class="mdescLeft">&#160;</td><td class="mdescRight">从一张图片创建一个精灵帧  <a href="#a4eda9a9e4569d2dd5cb26568087c4e70">更多...</a><br /></td></tr>
<tr class="separator:a4eda9a9e4569d2dd5cb26568087c4e70"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adb456f20ce5ee0af5ba654675e1afb43"><td class="memItemLeft" align="right" valign="top">static std::shared_ptr&lt; <a class="el" href="class_sprite_frame.html">SpriteFrame</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_frame.html#adb456f20ce5ee0af5ba654675e1afb43">createFromTexture</a> (const std::shared_ptr&lt; <a class="el" href="class_texture2_d.html">Texture2D</a> &gt; &amp;testure, const <a class="el" href="class_rect.html">Rect</a> &amp;des_rect_in_tex)</td></tr>
<tr class="memdesc:adb456f20ce5ee0af5ba654675e1afb43"><td class="mdescLeft">&#160;</td><td class="mdescRight">从纹理创建一个精灵帧  <a href="#adb456f20ce5ee0af5ba654675e1afb43">更多...</a><br /></td></tr>
<tr class="separator:adb456f20ce5ee0af5ba654675e1afb43"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected 成员函数</h2></td></tr>
<tr class="memitem:a0b5695823e52097516debc4ebbed6cca"><td class="memItemLeft" align="right" valign="top"><a id="a0b5695823e52097516debc4ebbed6cca"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>initWithTextureFileName</b> (const std::wstring &amp;file_name)</td></tr>
<tr class="separator:a0b5695823e52097516debc4ebbed6cca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b6cd2523e499eeb9cc6f6fa3df75663"><td class="memItemLeft" align="right" valign="top"><a id="a4b6cd2523e499eeb9cc6f6fa3df75663"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>initWithTextureFilename</b> (const std::wstring &amp;fileName, const <a class="el" href="class_rect.html">Rect</a> &amp;rect)</td></tr>
<tr class="separator:a4b6cd2523e499eeb9cc6f6fa3df75663"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ab987a8d2a3eba32034a41279931c24"><td class="memItemLeft" align="right" valign="top"><a id="a9ab987a8d2a3eba32034a41279931c24"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>initWithTextureFilename</b> (const std::wstring &amp;fileName, const <a class="el" href="class_rect.html">Rect</a> &amp;rect, bool rotated, const <a class="el" href="class_vector2.html">Vector2</a> offset, const <a class="el" href="class_size.html">Size</a> &amp;originalSize)</td></tr>
<tr class="separator:a9ab987a8d2a3eba32034a41279931c24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab6ebbb89af2aff010807963ce72fa13e"><td class="memItemLeft" align="right" valign="top"><a id="ab6ebbb89af2aff010807963ce72fa13e"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>initWithTexture</b> (const std::shared_ptr&lt; <a class="el" href="class_texture2_d.html">Texture2D</a> &gt; &amp;texture, const <a class="el" href="class_rect.html">Rect</a> &amp;rect, bool rotated, const <a class="el" href="class_vector2.html">Vector2</a> &amp;offset, const <a class="el" href="class_size.html">Size</a> &amp;originalSize)</td></tr>
<tr class="separator:ab6ebbb89af2aff010807963ce72fa13e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>精灵帧 </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a1d8c776029a8731967ab5a7e206f8954"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d8c776029a8731967ab5a7e206f8954">&#9670;&nbsp;</a></span>~SpriteFrame()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SpriteFrame::~SpriteFrame </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>析构 </p>
<dl class="section return"><dt>返回</dt><dd></dd></dl>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a6b16fce25f8844bd0b076ba2097e5aa0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6b16fce25f8844bd0b076ba2097e5aa0">&#9670;&nbsp;</a></span>createFromPicture() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static std::shared_ptr&lt;<a class="el" href="class_sprite_frame.html">SpriteFrame</a>&gt; SpriteFrame::createFromPicture </td>
          <td>(</td>
          <td class="paramtype">const std::wstring &amp;&#160;</td>
          <td class="paramname"><em>file_name</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从一张图片创建一个精灵帧 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">const</td><td>std::wstring &amp; file_name 图片的名字</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>std::shared_ptr&lt;SpriteFrame&gt;</dd></dl>
<p>当图片被程序加载过一次，则会被缓存起来。多次调用别不会多次从磁盘加载图片。 </p>

</div>
</div>
<a id="a4eda9a9e4569d2dd5cb26568087c4e70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4eda9a9e4569d2dd5cb26568087c4e70">&#9670;&nbsp;</a></span>createFromPicture() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static std::shared_ptr&lt;<a class="el" href="class_sprite_frame.html">SpriteFrame</a>&gt; SpriteFrame::createFromPicture </td>
          <td>(</td>
          <td class="paramtype">const std::wstring &amp;&#160;</td>
          <td class="paramname"><em>fileName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_rect.html">Rect</a> &amp;&#160;</td>
          <td class="paramname"><em>des_rect_in_tex</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从一张图片创建一个精灵帧 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">const</td><td>std::wstring &amp; fileName 图片的名字 </td></tr>
    <tr><td class="paramname">const</td><td><a class="el" href="class_rect.html" title="矩形">Rect</a> &amp; des_rect_in_tex 精灵在图片中的矩形区域 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>std::shared_ptr&lt;SpriteFrame&gt; 当图片被程序加载过一次，则会被缓存起来。多次调用别不会多次从磁盘加载图片。 通过指定精灵帧在图片中的区域，方便将多个精灵打包到一个图片 。 </dd></dl>

</div>
</div>
<a id="adb456f20ce5ee0af5ba654675e1afb43"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb456f20ce5ee0af5ba654675e1afb43">&#9670;&nbsp;</a></span>createFromTexture()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static std::shared_ptr&lt;<a class="el" href="class_sprite_frame.html">SpriteFrame</a>&gt; SpriteFrame::createFromTexture </td>
          <td>(</td>
          <td class="paramtype">const std::shared_ptr&lt; <a class="el" href="class_texture2_d.html">Texture2D</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>testure</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_rect.html">Rect</a> &amp;&#160;</td>
          <td class="paramname"><em>des_rect_in_tex</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从纹理创建一个精灵帧 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">const</td><td>std::shared_ptr&lt;Texture2D&gt; &amp; testure 纹理 </td></tr>
    <tr><td class="paramname">const</td><td><a class="el" href="class_rect.html" title="矩形">Rect</a> &amp; des_rect_in_tex 精灵帧在纹理中的矩形区域 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>std::shared_ptr&lt;SpriteFrame&gt; </dd></dl>

</div>
</div>
<a id="a7caab90d4ee888a3260f36c52146ca6d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7caab90d4ee888a3260f36c52146ca6d">&#9670;&nbsp;</a></span>getRect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="class_rect.html">Rect</a>&amp; SpriteFrame::getRect </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取精灵帧在纹理中的矩形位置 </p>
<dl class="section return"><dt>返回</dt><dd>const <a class="el" href="class_rect.html" title="矩形">Rect</a> &amp; </dd></dl>
<dl class="section see"><dt>参见</dt><dd>void <a class="el" href="class_sprite_frame.html#a97b4f437895f61f48aa6462930a5c298" title="设置精灵帧在纹理中的矩形区域">setRect(const Rect &amp; rect)</a> </dd></dl>

</div>
</div>
<a id="a3e8ab6dc78b0698ec1ee82dcd5258c6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e8ab6dc78b0698ec1ee82dcd5258c6b">&#9670;&nbsp;</a></span>getTexture()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::weak_ptr&lt;<a class="el" href="class_texture2_d.html">Texture2D</a>&gt; SpriteFrame::getTexture </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取精灵帧的纹理 </p>
<dl class="section return"><dt>返回</dt><dd>std::weak_ptr&lt;Texture2D&gt; </dd></dl>

</div>
</div>
<a id="a97b4f437895f61f48aa6462930a5c298"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97b4f437895f61f48aa6462930a5c298">&#9670;&nbsp;</a></span>setRect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SpriteFrame::setRect </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_rect.html">Rect</a> &amp;&#160;</td>
          <td class="paramname"><em>rect</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置精灵帧在纹理中的矩形区域 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">const</td><td><a class="el" href="class_rect.html" title="矩形">Rect</a> &amp; rect </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>void </dd></dl>
<dl class="section see"><dt>参见</dt><dd>const <a class="el" href="class_rect.html" title="矩形">Rect</a> &amp; <a class="el" href="class_sprite_frame.html#a7caab90d4ee888a3260f36c52146ca6d" title="获取精灵帧在纹理中的矩形位置">getRect()const</a> </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>C:/code/SkyGameEngine2d/src/node/<a class="el" href="_sprite_frame_8h_source.html">SpriteFrame.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
